#include "srv_triggers_runner.hpp"
#include "srv_time_trigger.hpp"
#include "project_manager/api/pm_trigger.hpp"

#include <iostream>

/*---------------------------------------------------------------------------*/

namespace Server {

/*---------------------------------------------------------------------------*/


TriggersRunner::TriggersRunner()
{
}


/*---------------------------------------------------------------------------*/


TriggersRunner::~TriggersRunner()
{
	for ( int i = 0; i < m_triggers.size(); ++i )
	{
		//m_triggers[i]->terminate();
		delete m_triggers[i];
	}
}


/*---------------------------------------------------------------------------*/


void
TriggersRunner::runTrigger( const ProjectManager::Trigger& _trigger )
{
	m_triggers.push_back( new TimeTrigger( _trigger, *this ) );
	m_triggers.back()->runTrigger();
}


/*---------------------------------------------------------------------------*/


void
TriggersRunner::onTrigger()
{
	std::cout << "Trigger!\n";
}


/*---------------------------------------------------------------------------*/

} // namespace Server
